package com.hiwan.unions.activity.membership;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import com.hiwan.unions.R;
import com.hiwan.unions.activity.base.RootActivity;

/**
 * Created by llg on 2017/7/15.
 */
public class MembershipTypeActivity extends RootActivity {
    private String titles;
    private LinearLayout layout_no, layout_yes;

    public static void startPreview(Context context, String title, boolean type, boolean typeMem) {
        Intent intent = new Intent(context, MembershipTypeActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("title", title);
        bundle.putBoolean("type", type);
        bundle.putBoolean("typeMem", typeMem);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_mem_type;
    }

    @Override
    protected void initData() {
        bundle = getIntent().getExtras();
        titles = bundle.getString("title");
        setTitleTxt(titles);
        if (bundle.getBoolean("type")) {
            layout_yes.setVisibility(View.VISIBLE);
        } else {
            layout_no.setVisibility(View.VISIBLE);
        }
    }

    @Override
    protected void IntentConfirm() {
        super.IntentConfirm();
        if (bundle.getBoolean("type")) {
            com.hiwan.unions.activity.system.MembershipActivity.startPreview(this);
        } else {
            MembershipActivity.startPreview(this, "", titles, true);
        }
        finish();
    }

    @Override
    protected void onViewCreated() {
        super.onViewCreated();
        layout_no = findView(R.id.layout_no);
        layout_yes = findView(R.id.layout_yes);
    }
}
